package com.atguigu.scala.chapter10
import scala.language.implicitConversions

/**
 * @author lizikuan
 * @date 2021/5/25 20:02
 */
object $01_ImplicitFunction {
  implicit val z = 10
  class RichMax(val self:Int){
    def myMax(x:Int) : Int= {
      if(self>x) self
      else x
    }
    def myMin(x:Int) ={
      if(self<x) self
      else x
    }
  }

  def main(args: Array[String]): Unit = {
  implicit def convert(x:Int)={
    new RichMax(x)
  }
    val b = 6
    println(b.myMax(2))
  }

}
